import request from '@/utils/request'
import type { ISkuData } from './types'

enum API {
  SKU_URL = '/admin/product/list/',
  CANCELSALE_URL = '/admin/product/cancelSale/',
  ONSALE_URL = '/admin/product/onSale/',
  SKUINFO_URL = '/admin/product/getSkuInfo/'
}

export const reqSkuList = (page: number, limit: number) => request.get<any, Common<ISkuData>>(API.SKU_URL + `${page}/${limit}`)
export const reqOnOrCancelSale = (skuId: number, status: number) => {
  if (status == 1) {
    return request.get<any, Common<any>>(API.CANCELSALE_URL + skuId)
  } else {
    return request.get<any, Common<any>>(API.ONSALE_URL + skuId)
  }
}

export const reqSkuInfo = (skuId: number) => request.get<any, any>(API.SKUINFO_URL + skuId)
